package demo.cxf.soap_spring_cxf_wss4j;

import org.apache.cxf.binding.soap.SoapMessage;
import org.apache.cxf.binding.soap.interceptor.AbstractSoapInterceptor;
import org.apache.cxf.interceptor.Fault;
import org.apache.cxf.phase.Phase;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

@Component
public class ErrorHandlerInterceptor extends AbstractSoapInterceptor {
	private static final Logger logger = LoggerFactory
			.getLogger(ErrorHandlerInterceptor.class);
	
	public ErrorHandlerInterceptor() {
		super(Phase.MARSHAL);
	}
	public ErrorHandlerInterceptor(String p) {
		super(p);
	}
	@Override
	public void handleMessage(SoapMessage message) throws Fault {
		System.out.println(message.getContent(Exception.class));
	}

}
